package basic;

import java.util.HashMap;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;

public class HashThreadTest {

    public static void main(String[] args) throws InterruptedException {
        final HashMap<String,String> map = new HashMap<>(2);
        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                for(int i=0;i<10000;i++){
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            map.put (UUID.randomUUID ().toString (), "");
                        }
                    } , "ftf" + i).start();
                }
            }
        },"ftf");
        t.start();
        t.join();

        for (String str:map.keySet()){
            System.out.println("key:"+str+".value:"+map.get(str));
        }
    }

}
